package com.test.springboot3.springboot3testdemo1.config;

import org.springframework.boot.autoconfigure.cache.RedisCacheManagerBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration;

/**
 * Created with IntelliJ IDEA.
 *
 * @author： liuziyang
 * @date： 2024/8/6-下午3:24
 * @description：
 * @modifiedBy：
 * @version: 1.0
 */
@Configuration
public class CacheConfiguration {

  @Bean
  public RedisCacheManagerBuilderCustomizer redisCacheManagerBuilderCustomizer() {
    return builder ->
        builder
            .withCacheConfiguration(
                "calc",
                RedisCacheConfiguration.defaultCacheConfig()
                    .entryTtl(java.time.Duration.ofSeconds(5)))
            .withCacheConfiguration(
                "test",
                RedisCacheConfiguration.defaultCacheConfig()
                    .entryTtl(java.time.Duration.ofSeconds(10)));
  }
}
